import { componentToSlot } from 'element-plus/es/components/table-v2/src/utils.mjs'
import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    redirect: '/browse' // 访问根路径时自动跳转到 /home
  },
  {
    path: '/home',
    name: '主页',
    component: ()=>import('../layout/index.vue'),
    redirect: '/index',
    children: [
      {
        path: '/index',
        name: '首页',
        component: () => import('../views/index/index.vue')
      },
      {
        path: '/write/articles',
        name: '文章管理',
        component: () => import('../views/write/articles/index.vue')
      },
      {
        path: '/write/type',
        name: '类型管理',
        component: () => import('../views/write/type/index.vue')
      },
      {
        path: '/write/analysis',
        name: '数据记录',
        component: () => import('../views/write/analysis/index.vue')
      },
      {
        path: '/mis/profile',
        name: '个人信息',
        component: () => import('../views/mis/profile.vue')
      },
      {
        path: '/mis/notice',
        name: '公告信息',
        component: () => import('../views/mis/notice.vue')
      },
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/browse',
    name: 'customer',
    component: () => import('../views/customer/index.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
